package demo04;

import org.junit.jupiter.api.Test;

public class MyTest {
    @Test
    public void test() {
        //真实对象
        UserServiceImpl userService = new UserServiceImpl();
        //代理对象的调用处理程序
        ProxyInvocationHandler pih = new ProxyInvocationHandler();
        pih.setTarget(userService); //设置要代理的对象
        UserService proxy = (UserService) pih.getProxy(); //动态生成代理类！
        proxy.delete();
    }
}
